home *** CD-ROM | disk | FTP | other *** search
- #!/usr/sbin/perl
- #
- # webdist.install.cgi
- #
- # This script is used by Web Installation Pages generated by the
- # webdist utility.
- #
-
- ## Copyright 1995, Silicon Graphics, Inc.
- ## All Rights Reserved.
- ##
- ## This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- ## the contents of this file may not be disclosed to third parties, copied or
- ## duplicated in any form, in whole or in part, without the prior written
- ## permission of Silicon Graphics, Inc.
- ##
- ## RESTRICTED RIGHTS LEGEND:
- ## Use, duplication or disclosure by the Government is subject to restrictions
- ## as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- ## and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- ## successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- ## rights reserved under the Copyright Laws of the United States.
-
-
- #
- # Process cgi args
- #
-
- if( $ENV{'REQUEST_METHOD'} eq "GET" )
- {
- $buffer=$ENV{'QUERY_STRING'} ;
- }
- else
- {
- read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}) ;
- }
- @pairs = split(/&/, $buffer) ;
- foreach (@pairs)
- {
- tr/+/ / ;
- ($name,$value)= split(/=/) ;
- $value =~ s/%(..)/pack("c",hex($1))/ge ;
- $name =~ s/%(..)/pack("c",hex($1))/ge ;
-
- $in{$name} = $value;
-
- }
-
-
-
- #
- # Get list of products and the location of the distribution directory
- #
-
- @products = sort(split(" ", $in{products}));
- $distdir = $in{distdir};
-
-
-
- #
- # Collect selected products in selprods. If none are selected -- the maximum
- # index is -1 -- report error.
- #
-
- foreach $i (@products) {
- if ($in{$i} eq "on") {
- push(@selprods, $i);
- $dist = $distdir . "/" . $i;
- }
- }
-
-
- if ( $#selprods < 0 ) {
- &report_fatal_error("No products selected for installation!");
- }
-
- #
- # If the max index of selected products is not zero, there are more than
- # one selected products. Use the distribution directory as the dist location.
- #
-
- if ($#selprods != 0) {
- $dist = $distdir;
- }
-
-
-
- #
- # Output header for inst install file type, x-install,
- # and the blank line needed by browser to recognize header
- #
-
-
- print "Content-type: application/x-install\n\n";
-
- #
- # Output inst selections file header
- #
-
- print "#! /usr/sbin/SoftwareManager -F\n";
- print "#Tag 000109B1\n";
- print "from $dist\n";
-
- #
- # Output resources to start installation immediately if requested
- #
-
- if { $in{options} eq "immediate" } {
- print "s automatic true\n";
- print "s background false\n";
- print "s interactive false\n";
- print "s delayspacecheck true\n";
- print "s report_exit_status false\n";
- }
-
-
- #
- # Output selections based on the value of the toggle buttons
- #
-
- print "\n";
- foreach $i (@selprods) {
- print "i $i\n";
- }
-
-
-
- #
- # Report fatal error in the form of a Web page
- #
-
- sub report_fatal_error {
- local ($msg) = @_;
-
- print "Content-type: text/html\n\n";
- print "<HTML>\n";
- print "<TITLE>Web Installation Error</TITLE>\n";
- print "</HEAD>\n";
- print "<BODY>\n";
- print "<H3>Web Installation Error</H3>\n";
- print "$msg\n";
- print "</BODY>\n";
-
- exit 0
- }
-